DDC1
 
Component DDC1
DDC1 communication interface
Component Level: High
Typical Usage:
(Examples of a typical usage of the component in user code. For more information please see the page Component Code Typical Usage.)

Assume the component name "DC1". Some examples of typical usage of this component follows:

(1)
The first typical usage of this component shows how to store a byte of the data to the output buffer. After clock signal is initiated to Vsync, more bytes are sent using event OnTxChar.

MAIN.C

byte message[]={10,11,12};
byte snd;

void main(void)
{

    :
  snd = 0;
  (void)DC1_SendChar(message[0]);
  snd++;

    :

}

EVENTS.C

extern byte snd;
extern byte message[];

void DC1_OnTxChar(void)
{
  (void)DC1_SendChar(message[snd]);
  snd++;
  if(snd == 4) snd=0;
}

(2)
To send more bytes, its better to use SendBlock method, that stores all bytes to the output buffer.OnFreeTxBuf event indicates completition of the transmission. Following bean settings are supposed: Output buffer size 5.

MAIN.C

byte message[]={10,11,12};
byte flag;
word snd;

void main(void)
{

     :
  flag = 0;
  (void)DC1_SendBlock(message,3,&snd);

     :
  
  if (flag == 1) {
    flag = 0;
    /* message completed */
  }
}

EVENTS.C

extern byte flag;

void DC1_OnFreeTxBuf(void)
{
  flag = 1;
}